/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package qq;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import static qq.Client.out;

/**
 *
 * @author castle
 */
public class TCPClient {
//    新建一个OutPutStream属性
    public OutputStream out;
//    新建一个输入流
    public InputStream in;
    //迁移到静态属性中，方便外部访问
    public PrintWriter pw;
    //把窗体对象引用过来
    public QQMain main;
    public void start(){
        try {
            //新建客户端
            Socket client = new Socket("192.168.2.100",8900);
//            获取输出流
            out = client.getOutputStream();
            pw=new PrintWriter(out);//将输出流包装成打印流
            //测试客户都安连接，发送数据，不与逻辑进行绑定
//            pw.print("I am aa");
//          清空缓冲区，立即发送
//            pw.flush();
            //新建发送内容的byte数组
            ClientReceiveThread crt = new ClientReceiveThread(client, main);
            crt.start();
            //清空缓冲区 1357924680
//            out.close();
//            in.close();
//            client.close();            
        } catch (Exception e) {
            
        }
    }
}
